<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[#include "/admin/include/head.htm"]
	<script>

		function f_change(id){
			top.f_addTab(null, '修改人员', base+'/admin/rbac/editEmp.aspx?id='+id);
		}

		function f_add(){
			top.f_addTab(null, '添加人员', base+'/admin/rbac/editEmp.aspx');
		}

		function f_deleteEmp(row){
            console.log(row.id+","+row.name);
			jQuery.ligerDialog.confirm('确定要删除【'+row.name+'】吗？', function (confirm) {
				if (confirm){
					$.ajax({
						type: "post",
						url: '${path}/admin/rbac/delemp.aspx',
						data: { "id": row.id },
						success: function (result) {
							LG.showSuccess(result, function(){
								window.location.reload();
							});
						},
						error: function (o, a, e) {
							if(o.status == 400)
								LG.showError(o.responseText);
						},
						dataType: "text"
					});
                }
			});
		}

		var grid;
		$(function(){
			grid = $("#maingrid").ligerGrid({
				columns: [

					{display: '用户ID', name: 'id', align: 'center', width: 100 },
					{display: '用户名', name: 'name', align: 'center', width: 150 },
                    {display: '登录名', name: 'admin_name', align: 'center', width: 150 },
			        {display: '会员名称', name: 'depart_name', align: 'center', width: 150 },
					{display: '操作',  align: 'center', width: 100,
						render: function(row){
							var html = '<input value="修改" style="cursor:pointer" type="button" onclick="f_change('+row.id+')">';
							return html;

						}
					},
					{display: '操作',  align: 'center', width: 100,
						render: function(row){
							var html = '<input value="删除" style="cursor:pointer" type="button" onclick=f_deleteEmp('+JSON.stringify(row)+')>';
							return html;
						}
					}
				],  pageSize:20, url: 'queryEmpData.aspx',toolbar: {}, width: '100%', height:'100%', enabledSort: true
			});

			//绑定搜索按钮
			LG.search(grid);

		});


	</script>
</head>

<body style="overflow:hidden;padding:10px;">
<div id="functions">
	<div class="clearfix">
		<div style="float:left;">
			<form id="exportForm" method="post">

				<span>
					用户ID：<input type="text" onkeyup="value=value.replace(/[^(\d)]/g,'')" value="${userId}" name="userId" />
			</span>
				<span>
					用户名：<input type="text" name="userName" value="${userName}" />
			</span>

				<input type="button" class="button" value="搜索" id="search"/>
				<a href="#" id="search_btn_reset" face="Wingdings 3">清除本次搜索</a>
				<input type="button"  value ='添加' class="button" onclick="f_add()" />

			</form>
		</div>
	</div>
</div>

<div id="maingrid" style="margin:0; padding:0"></div>
</body>

</html>